export const getUrlParam = (paraName: string) => {
  var url = document.location.toString();
  var arrObj = url.split("?");

  if (arrObj.length > 1) {
    var arrPara = arrObj[1].split("&");
    var arr;

    for (var i = 0; i < arrPara.length; i++) {
      arr = arrPara[i].split("=");

      if (arr != null && arr[0] === paraName) {
        return arr[1];
      }
    }
    return "";
  } else {
    return "";
  }
};

export function isInnerNet(ip: string) {
  console.log("地址栏输入的ip或域名：" + ip);
  if (ip == "localhost" || ip == "127.0.0.1") return true; //内网
  var segment = ip.split(".");
  if (segment[0] == "10") {
    return true; //内网
  } else if (segment[0] == "172") {
    var s2 = parseInt(segment[1]);
    if (s2 >= 16 && s2 <= 31) {
      return true; //内网
    } else return false;
  } else if (segment[0] == "192" && segment[1] == "168") {
    return true;
  } else return false; //外网
}